refactor(agent): remove redundant 'lock' command (keep only 'stop') - #135
Merged
Conversation
lock and stop had become identical (both zero the resident secrets and stop the agent), so having two commands for one action was just confusing. Remove lock entirely — the top-level 'pass-cli lock' and 'pass-cli agent lock', plus the now-dead MethodLock RPC and client LockAgent(). 'pass-cli agent stop' is the sole way to stop a running agent. Internal auto-lock (idle/max-TTL) and the serve.go 'stop when locked' behavior are unchanged — MethodShutdown still zeroes secrets via lockLocked, and the socket is still freed promptly. Unit tests that used MethodLock to lock the agent now use MethodShutdown (identical at the Agent level); the LockThenFallback integration test folds into StopThenFallback (which now asserts the socket is freed promptly). All agent unit + integration tests pass; lint clean on linux/darwin; builds on windows. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014kVLjbUL4F4CkoA7RbMYy8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Per your call:
lockandstophad become identical (both zero the resident secrets and stop the agent), so keeping two commands for one action was just confusing. This removeslockentirely —pass-cli agent stopis the single verb.Removed
pass-cli lockandpass-cli agent lockcommands (cmd/lock.godeleted).MethodLockprotocol method and the clientLockAgent().Unchanged
MethodShutdownstill zeroes secrets vialockLocked, andserve.gostill frees the socket promptly when the agent locks.agent stopbehaves exactly aslockdid: zero secrets, stop, free the socket, next command falls back to direct-open.Tests
MethodLockto lock the agent now useMethodShutdown(identical at the Agent level).LockThenFallbackintegration test folds intoStopThenFallback, which now also asserts the socket is freed promptly.🤖 Generated with Claude Code